<template>
  <div class="archive-other-info__item">
    <span class="icon__item el-icon-files">{{resourceText}}: {{ resourceCount }}</span>
    <span class="icon__item el-icon-chat-line-square">评论: {{ commentCount }}</span>
    <span class="icon__item el-icon-headset">浏览: {{ playCount }}</span>
    <span class="icon__item el-icon-star-off">点赞: {{ starCount }}</span>
    <span class="icon__item el-icon-folder-opened">分类: {{ classifyName }}</span>
  </div>
</template>

<script>
export default {
    name: 'ArchiveCardMetaModule',
    props: {
        archive: {
            type: Object,
            required: true,
        },
    },
    computed: {
        archiveType() {
            return this.archive.type;
        },
        resourceText() {
            if (this.archiveType === 4) return '附件'; // 如果是文章稿件的话,替换资源文字为附件
            return '资源';
        },
        resourceCount() {
            if (this.archiveType === 4) { // 如果是文章稿件的话,就用图片附件数量当作资源数量
                return this.images.split(',').length;
            }
            return this.archive.rcount || 0;
        },
        images() {
            return this.archive.images || '';
        },
        commentCount() {
            return this.archive.rpcount || 0;
        },
        playCount() {
            return this.archive.hit || 0;
        },
        starCount() {
            return this.archive.liked || 0;
        },
        classifyName() {
            return this.archive.className || '';
        },

    },
};
</script>

<style lang="scss">
.archive-other-info__item {
  font-size: 12px;
  color: $textGrey;
  .icon__item {
    margin-right: 20px;
  }
  .icon__item::before {
    margin-right: 5px;
  }
}
</style>
